//
//  UINavigationItem+correct_offset.m
//  yeasoon
//
//  Created by User on 15/10/27.
//  Copyright © 2015年 lchenc3. All rights reserved.
//

#import "UINavigationItem+correct_offset.h"

@implementation UINavigationItem (correct_offset)

- (void)addLeftBarButtonItem:(UIBarButtonItem *)leftBarButtonItem
{

    // Add a spacer on when running lower than iOS 7.0
    UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                                                                   target:nil action:nil];
    negativeSpacer.width = -8;
    [self setLeftBarButtonItems:[NSArray arrayWithObjects:negativeSpacer, leftBarButtonItem,nil]];
    
}

- (void)addRightBarButtonItem:(UIBarButtonItem *)rightBarButtonItem
{
    // Add a spacer on when running lower than iOS 7.0
    UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    negativeSpacer.width = -8;
    [self setRightBarButtonItems:[NSArray arrayWithObjects:negativeSpacer, rightBarButtonItem,nil]];
}

@end
